Skip to content

fix(app): keep numbered sub-list markers off their text on Android - #9964

Closed
boudra wants to merge 1 commit into
mainfrom
diagnose-nested-bullet-number-overlap
Closed

boudra wants to merge 1 commit into
mainfrom
diagnose-nested-bullet-number-overlap

Conversation

@boudra

@boudra boudra commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator

Linked issue

None. Reported from a phone screenshot of an agent reply.

Type of change

  • Bug fix
  • New feature
  • Enhancement
  • Refactor
  • Docs

Reasoning

On Android, a numbered list inside a bulleted item drew each number on the first letter of its item, for example "1A reused branch name…" instead of "1. A reused branch name…". Agent replies use this shape often, such as a bullet that introduces numbered cases. Chat, file previews, plans and PRs were all affected.

The cause is in react-native-enriched-markdown's Android list layout. A nested item's text indent was the root list's marker column (a 3dp bullet + 7dp gap) plus a fixed marginLeft (20dp), which is 30dp. Its number was right-aligned to its own 99. column, ending at about 41dp. iOS indents from the item's own column and was not affected.

Upstream fixed this in enriched-markdown#1023, which builds on #1015. Both merged after our pinned nightly. This PR backports their Android hunks into our existing package patch.

Why not upgrade to 1.2.0, which ships both? 1.2.0 replaces the md4c parser. Our patch carries md4c autolink fixes and a recompiled web WASM parser. A 3-way merge of the patch onto 1.2.0 conflicted in 44 files. That upgrade is its own piece of work.

Goals

  • On Android, nested list items start their text after their own marker column, for all mixes: numbered under bullet, tasks under bullet, and bullets under a number.
  • Same-type nests (bullet in bullet, number in number) and top-level lists keep their current geometry.
  • Every existing patch hunk is unchanged. The backport only adds or replaces sections for the list files.

Non-goals

QA

Android emulator (API 35), dev client built from this branch with sim app android, connected to a dev daemon. I opened a workspace Markdown file in Explorer → Files → Preview with:

- **What ready means:** evidence it observed, for each case:
  1. A reused branch name with an old closed PR.
  2. A fresh workspace on the base commit of an old PR.
  3. An open PR.
- **Unordered in unordered:**
  - Alpha nested bullet.
1. Ordered root item:
   1. Ordered nested item.
- Tasks under a bullet:
  - [ ] Unchecked task.
  - [x] Checked task.
1. Bullets under a number:
   - Nested bullet one.
  • Before (same file, dev client built from main): the numbered items under the bullet render as "1A reused branch…", "2A fresh workspace…", "3An open PR.", with each digit over the first letter. Same-type nests render correctly.
  • After: "1. A reused branch…", "2. …", "3. …" with the normal gap. Tasks under a bullet and bullets under a number also sit at their own column. Same-type nests and top-level lists look the same as before.

Patch integrity: applying the new patch to the clean 1.2.0-nightly-20261014-766fc0e67 package with patch-package --error-on-fail produces exactly the intended tree. node --test scripts/postinstall-patches.test.mjs scripts/ci-workflow.test.mjs: 31 pass.

Not run locally: the backported Robolectric suites ListRenderingTest (it includes mixedNestsStartTheirTextFromTheirOwnMarkerColumn) and TaskListInteractionTest. They are now part of npm run test:android.

Not tested: iOS and web, which have no code changes. The app builds their native and JS from untouched files.

Checklist

  • Plugin changes follow the SDK import boundaries (if applicable)
  • One focused change
  • npm run typecheck passes (no TypeScript changes)
  • npm run lint passes
  • npm run format passes
  • QA evidence
  • Tests added or updated where it made sense

On Android, a numbered list nested in a bulleted item drew "1." over
the first letters of each item. A nested item's text indent summed the
root list's narrow bullet column with a fixed marginLeft, while its
marker was right-aligned to its own wider "99." column, so the number
landed on the text. iOS already indents from the item's own column.

Backport the Android hunks of upstream enriched-markdown #1015 (size
the number column to the widest marker) and #1023 (nested items start
their text from their own marker column) into the existing package
patch. Upgrading to 1.2.0, which ships both, would also swap the md4c
parser that our patch's autolink fixes and web WASM build depend on.

test:android now also runs the backported ListRenderingTest and
TaskListInteractionTest suites.
@paseo-bot

paseo-bot Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Confidence 5/5

No open findings. The new patch is an exact backport of the Android hunks of upstream enriched-markdown #1015 and #1023. Applied to the pinned nightly, it compiles, and the backported Robolectric suites pass, including the repro for this bug. One thing to know before merging: on Android, bullets nested under a numbered item now sit much closer to their parent's text. That is upstream's intended layout and matches iOS, but it is a visible change on top of the overlap fix.

Summary

Before, on Android, a numbered list under a bullet drew each number on top of its item's first letter ("1A reused branch name…"). After, each nested item starts its text after its own marker column ("1. A reused branch name…"). This covers numbers under a bullet, tasks under a bullet and bullets under a number, in chat, file previews, plans and PRs. iOS and web are unchanged.

Product changes

  • Android: numbered and task lists nested under a bullet put their text after their own marker, so the numbers and checkboxes no longer overlap the text.
  • Android: bullets and tasks nested under a numbered item move left, matching iOS. With Paseo's list style (marginLeft 20, gapWidth 7), the nested text now starts about 3dp right of the parent item's text, down from about 20dp. The bullet dot sits slightly left of the parent's text column.
  • Android: an ordered list that reaches 100 or more widens its number column to fit its widest number, instead of always reserving a 99. column (from feat: configurable quick prompt buttons above the composer #1015).
  • Android: nested lists of the same type (bullet in bullet, number in number) and top-level lists keep their layout. A nested level can shift by up to 1px, because rounding now applies to each level's total indent instead of to each level's own margin.
  • Developer: npm run test:android also runs ListRenderingTest and TaskListInteractionTest.

Size

The size fits the problem. The change reuses the existing package patch and the upstream fix rather than writing its own layout logic, and the PR's reason for not upgrading to 1.2.0 holds: 1.2.0 swaps the md4c parser that this patch's autolink fixes and the web WASM build depend on. The new comment in scripts/postinstall-patches.mjs says which hunks to drop on that upgrade, and 1.2.0 contains both upstream PRs. Inside the patch, the backport changes about 181 lines of library Kotlin (38 removed). The rest of the patch growth is upstream's tests.

Category Added Removed
Production (library patch hunks, package.json script, postinstall comment) 486 4
Tests and fixtures (backported Robolectric suites and helpers inside the patch) 892 0
Generated artifacts (including lockfiles) 0 0
Total 1378 4

What could break

No open findings.

What I verified

Run in this review, at e9ec40a:

  • Patch integrity: npm pack of the pinned 1.2.0-nightly-20261014-766fc0e67, then git apply --check with both the old and the new patch. Both apply cleanly. The patched android/ tree matches what postinstall installs into packages/app/node_modules, with no differences.
  • Scope of the patch edit: comparing the old and new patch file by file shows 14 changed files, all of them Android list files (list renderers, list spans, TaskListTapUtils and the test helpers). No other file's hunks changed.
  • Backport fidelity: applying only the packages/react-native-enriched-markdown/android/* hunks of upstream feat: configurable quick prompt buttons above the composer #1015 and Fix upstream-gone ahead count #1023 to the pristine package plus the old patch gives an android/ tree identical to the new patch (diff -ru exit 0).
  • Compile and tests: ./gradlew :react-native-enriched-markdown:testReleaseUnitTest with the three --tests filters from test:android succeeded. InlineCodeFormattingTest 3/3, ListRenderingTest 18/18 (including mixedNestsStartTheirTextFromTheirOwnMarkerColumn), TaskListInteractionTest 3/3. I used an isolated Gradle home because the machine's shared Gradle cache is corrupt, which is unrelated to this PR.
  • Repo tests: node --test scripts/postinstall-patches.test.mjs scripts/ci-workflow.test.mjs passes 31/31.
  • Layout, traced through the source: for nested levels, the text indent and the marker's right edge both add up from the same per-level widths, so the marker-to-text gap equals gapWidth at every depth, including three or more levels. Right-to-left layout scales by dir. Code blocks inside items follow accumulatedIndent, so they stay aligned with the text. Toggling a task re-adds spans in their original order and copies the new fields.

Not verified in this review:

  • Emulator or device rendering. The PR's before/after QA on an Android API 35 emulator is the evidence for this.
  • iOS and web, which have no code changes.
  • Lists inside blockquotes; the code paths that draw them did not change.

CI does not run the Gradle suites (scripts/ci-workflow.test.mjs:205), so after merge these suites run only when someone runs npm run test:android locally. That gap predates this PR and does not affect the score.

Reviews (1) · Last reviewed commit: e9ec40a · Reviewed by Paseo

boudra added a commit that referenced this pull request Nov 23, 2026
… layouts (#10499)

* chore(app): vendor react-native-enriched-markdown with the Paseo patch applied

Copy react-native-enriched-markdown@1.2.0-nightly-20261014-766fc0e67 (upstream
software-mansion/enriched-markdown 766fc0e67) into
packages/react-native-enriched-markdown, with
patches/react-native-enriched-markdown+1.2.0-nightly-20261014-766fc0e67.patch
applied. Nothing else changes in this commit; the package is not a workspace yet.

Reproduce:

  npm pack react-native-enriched-markdown@1.2.0-nightly-20261014-766fc0e67
  tar xzf react-native-enriched-markdown-*.tgz
  mkdir -p t/node_modules && mv package t/node_modules/react-native-enriched-markdown
  (cd t && git init -q && git apply ../patches/react-native-enriched-markdown+*.patch)
  diff -r t/node_modules/react-native-enriched-markdown packages/react-native-enriched-markdown

The diff is empty.

* chore(app): consume react-native-enriched-markdown from its workspace

Make packages/react-native-enriched-markdown a private workspace and point the
app at it, then remove the patch-package patch it replaces.

- package.json: private, version follows the root like every workspace, only the
  postinstall script that downloads tree-sitter grammars. Upstream's
  devDependencies would install a second react-native, so they are gone.
- The package keeps its name, so autolinking, the Gradle project
  :react-native-enriched-markdown, the CocoaPods spec and imports are unchanged.
- Lockfile: drop the nested registry copy under packages/app/node_modules; npm
  links node_modules/react-native-enriched-markdown to the workspace.
- Formatting, lint and knip skip the vendored code. CI routes changes to it
  through the app and browser suites.
- The codegen test checks the vendored package's generated props.
- docs/markdown-renderer.md describes the fork and how to edit it.

* fix(app): keep numbered sub-list markers off their text on Android

From #9964, moved from the package patch into the vendored package.

On Android, a numbered list nested in a bulleted item drew "1." over
the first letters of each item. A nested item's text indent summed the
root list's narrow bullet column with a fixed marginLeft, while its
marker was right-aligned to its own wider "99." column, so the number
landed on the text. iOS already indents from the item's own column.

Backport the Android hunks of upstream enriched-markdown #1015 (size
the number column to the widest marker) and #1023 (nested items start
their text from their own marker column).

test:android now also runs the backported ListRenderingTest and
TaskListInteractionTest suites. docs/markdown-renderer.md lists the
fork's backports, this one and #924, which the removed postinstall
comment used to track.

The vendored tree equals the #9964 patch applied to the pristine
package.

* fix(app): keep Android assistant replies inside their turns

From #10380, moved from the package patch into the vendored package.

On Android, an assistant reply with blockquotes nested inside a list
could overlap its "Worked for ..." footer and the next user message:
the displayed text and the layout measurement applied spans in
different orders, and the list-wide line height inflated the blockquote
spacers when it ran after them.

Use the same span order for Android Markdown measurement and display.
Apply list line height before blockquote spacers so nested quotes keep
their configured padding and the reply fits above the turn footer.

test:android now also runs ListBlockquoteMeasurementTest.

Applied on top of #9964; the two changes share only ListRenderer.kt,
where #10380's import and line-height call sit beside #9964's marker
width code. Every other file equals the #10380 patch applied to the
pristine package.

* chore(app): match the vendored Markdown web block renderer source to its build

The package patch changed lib/module/web/renderers/BlockRenderers.js (the
renderers.codeBlock override and the zoom-in cursor on images) but not
src/web/renderers/BlockRenderers.tsx. The app runs lib, so behavior does
not change. Port both changes into src so src stays the source of lib.
@boudra

boudra commented Nov 23, 2026

Copy link
Copy Markdown
Collaborator Author

superseded by #10499 which is now merged to main.

@boudra boudra closed this Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant